﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CloudMailShared;
using Microsoft.WindowsAzure.ServiceRuntime;


namespace WebRole2
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButtonTest_Click(object sender, EventArgs e)
        {
            CloudMailClient cmc = new CloudMailClient("testmailqueue", RoleEnvironment.GetConfigurationSettingValue("CloudMailStorageConnectionString"));
            
            SerializableMailMessage msg = new SerializableMailMessage(TextBoxFrom.Text,TextBoxTo.Text){
                Subject = "CloudMail Test",
                Body = "This is a mail body",
                IsBodyHtml = true };

            cmc.sendMessage(msg);
        }
    }
}